package cn.risebd.wechat.exception;

import java.util.Map;

/**
 * @category 微信异常，微信服务器返回错误时抛出的异常
 * @author 喝咖啡的蚂蚁
 * @copyright risebd.cn
 *
 */
public class WechatException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2175700703061322917L;
	/**
	 * 微信返回的errcode
	 */
	private Integer code;

	public WechatException(Map<String, ?> errMap) {
		super("[" + errMap.get("errcode") + "]" + errMap.get("errmsg"));
		code = (Integer) errMap.get("errcode");
	}

	public WechatException() {
		super();
	}

	public WechatException(String message) {
		super(message);
	}

	public WechatException(String message, Throwable cause) {
		super(message, cause);
	}

	public WechatException(Throwable cause) {
		super(cause);
	}

	protected WechatException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
		super(message, cause, enableSuppression, writableStackTrace);
	}

	public Integer getCode() {
		return code;
	}
}
